<?php
/**
 * Created by PhpStorm.
 * User: zhou
 * Date: 2019/3/17
 * Time: 下午11:58
 */

namespace App\Http\Controllers\Admin;


use App\Http\Controllers\ApiController;
use App\Http\Controllers\Controller;
use App\Models\Hotel;
use App\Models\HotelOwnerApply;
use Illuminate\Http\Request;

class HotelOwnerController extends Controller
{
    public function apply_list(Request $request, HotelOwnerApply $hotelOwner)
    {
        $list = $hotelOwner -> apply_list($request -> all());
        $list['hotel_list'] = Hotel::list(null);
        $list['update_url'] = url('admin/hotelowner/update_status');
        return view('admin.hotelowner.index',$list);
    }

    public function update_status(Request $request, HotelOwnerApply $hotelOwner)
    {
        $res = $hotelOwner -> update_status_byid($request->all());
        $status = $request->input('status');
        $msg = '审核申请';
        switch ($status){
            case 0:
                $msg = '审核申请';
                break;
            case 1:
                break;
            case 2:
                break;

        }
        if($res){
            return ApiController::response(null);
        }else{
            return ApiController::response(null,400);
        }
    }

}